﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="detail.aspx.vb" Inherits="myWebsite.detail" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <p>

        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataSourceID="MotorcycleDb" DataKeyNames="ID" GridLines="None">

                <Columns>
                <asp:TemplateField SortExpression="Make">
                    <ItemTemplate>
                    <u>   <b><asp:Label ID="Label1" runat="server" Text='<%# Bind("Make") %>'></asp:Label>
                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("Model") %>'></asp:Label> </b> </u>
                    
                               
                         <br />  Category: <asp:Label ID="Label3" runat="server" Text='<%# Bind("Category") %>'></asp:Label>
                  
                         <br />   Difficulty: <asp:Label ID="Label4" runat="server" Text='<%# Bind("Difficulty") %>'></asp:Label>
                        </ItemTemplate>                       
                    </asp:TemplateField>
            </Columns>
        </asp:GridView>


          <br />
            <asp:GridView ID="GridView6" runat="server" AutoGenerateColumns="False" 
            DataSourceID="SqlDataSource6"  GridLines="None">
                <Columns>
                     <asp:BoundField DataField="DetailedDescription" 
                         SortExpression="DetailedDescription" />
                </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource6" runat="server" 
            ConnectionString="<%$ ConnectionStrings:MotorcyclesConn %>" 
            ProviderName="<%$ ConnectionStrings:MotorcyclesConn.ProviderName %>" 
            SelectCommand="SELECT [DetailedDescription] FROM [MyTable] WHERE ([ID] = ?)">
            <SelectParameters>
                <asp:QueryStringParameter Name="?" QueryStringField="ID" />
            </SelectParameters>
        </asp:SqlDataSource>
            <br />

        <asp:GridView ID="GridView3" runat="server" AutoGenerateColumns="False" 
            DataSourceID="SqlDataSource3" style="float:left" GridLines="None">
            <Columns>
                <asp:ImageField DataImageUrlField="Picture">
                    <ControlStyle Height="300px" Width="450" />
                </asp:ImageField>
            </Columns>
        </asp:GridView>

        <br />
         <asp:GridView ID="GridView5" runat="server" AutoGenerateColumns="False" 
            DataSourceID="SqlDataSource5" GridLines="None">
             <Columns>
                 <asp:BoundField DataField="AvgRating" HeaderText="AvgRating" ReadOnly="True" 
                     SortExpression="AvgRating" />
             </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource5" runat="server" 
            ConnectionString="<%$ ConnectionStrings:MotorcyclesConn %>" 
            ProviderName="<%$ ConnectionStrings:MotorcyclesConn.ProviderName %>" 
            SelectCommand="SELECT [MotorcycleFKID], [AvgRating] FROM [AverageRatingsQuery] WHERE ([MotorcycleFKID] = ?)">
            <SelectParameters>
                <asp:QueryStringParameter Name="MotorcycleFKID" QueryStringField="ID" 
                    Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
         <br />
        <asp:GridView ID="GridView4" runat="server" AutoGenerateColumns="False" 
            DataKeyNames="ID" DataSourceID="MotorcycleDb" GridLines="None">
            <Columns>
                <asp:HyperLinkField DataNavigateUrlFields="ID" 
                    DataNavigateUrlFormatString="ratings.aspx?ID={0}" 
                    Text="Rate" />
            </Columns>
        </asp:GridView>

        
       
        <asp:SqlDataSource ID="SqlDataSource7" runat="server" 
            ConnectionString="<%$ ConnectionStrings:MotorcyclesConn %>" 
            ProviderName="<%$ ConnectionStrings:MotorcyclesConn.ProviderName %>" 
            SelectCommand="SELECT DISTINCT [Tag] FROM [TagJoinerQuery] WHERE ([ID] = ?)">
            <SelectParameters>
                <asp:QueryStringParameter Name="?" QueryStringField="ID" />
            </SelectParameters>
        </asp:SqlDataSource>
        <br />
        
        <br />
        <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
            ConnectionString="<%$ ConnectionStrings:MotorcyclesConn %>" 
            ProviderName="<%$ ConnectionStrings:MotorcyclesConn.ProviderName %>" 
            SelectCommand="SELECT [Picture] FROM [MyTable] WHERE ([ID] = ?)">
            <SelectParameters>
                <asp:QueryStringParameter Name="ID" QueryStringField="ID" Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
        <br />
        <br />
        <asp:SqlDataSource ID="MotorcycleDb" runat="server" 
            ConnectionString="<%$ ConnectionStrings:MotorcyclesConn %>" 
            ProviderName="<%$ ConnectionStrings:MotorcyclesConn.ProviderName %>" 
            
            SelectCommand="SELECT [ID], [Make], [Model], [Category], [DetailedDescription], [Difficulty] FROM [MyTable] WHERE ([ID] = ?)">
            <SelectParameters>
                <asp:QueryStringParameter Name="ID2" QueryStringField="ID" Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
    </p>
     <br />
     <br />
     <br />
     <br />
     <br />
     <br />
     <br />
     <br />
     <br />
     This modification has already been tagged as 
     <asp:DropDownList ID="DropDownList1" runat="server" 
            DataSourceID="SqlDataSource7" DataTextField="Tag" DataValueField="Tag">
        </asp:DropDownList>
        <br />
        <br />
        Choose a new tag from one of these already created tags or type your own below
   <br />
    <asp:CheckBoxList ID="cbl_Tags" runat="server" 
        DataSourceID="SqlDataSource2" DataTextField="Tag" DataValueField="ID" 
        RepeatDirection="Horizontal">
    </asp:CheckBoxList>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:MotorcyclesConn %>" 
        ProviderName="<%$ ConnectionStrings:MotorcyclesConn.ProviderName %>" 
        SelectCommand="SELECT [ID], [Tag] FROM [Tags] ORDER BY [Tag]">
    </asp:SqlDataSource>
     
      Create new tag: <asp:TextBox ID="tb_CreateTag" runat="server"></asp:TextBox>
    <br />
      <br />
   

    
     <asp:Button ID="btn_SubmitTag" runat="server" Text="Submit tag" />
     
      <br />
   <br /> 
   <br />
   
   <div style="float:left">
    <p>
        Write your comment below <asp:LoginName ID="LoginName1" runat="server" />
    </p>
       <p>
        Title: <br />
        <asp:TextBox ID="tb_Title" runat="server" Width="228px"></asp:TextBox>
    </p>
    <p>
        Add your comment: <br />
        <asp:TextBox ID="tb_Comment" runat="server" Height="214px" Width="358px" 
            TextMode="MultiLine"></asp:TextBox>
    </p>
    <p>
        <asp:Button ID="btn_AddComment" runat="server" Text="Add your comment" />
         
    </p>
    </div>
 
       
    <div style="width: 400px; height: 400px; overflow: scroll; float:right">    
 
 
    <p>
           Comments:<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" 
            DataSourceID="SqlDataSource1"  >
            <Columns>
                <asp:TemplateField HeaderText="Comments">
                <ItemTemplate> 
                <div style="background-color:Silver">
                <b>                 
                <span style="text-decoration:underline">
                <h1><%# Eval("Author") %></span></center></b></h1>
                <br />        
                <b>
                <%# Eval("Subject") %> </b>
                <br />         
                <br />          
                <%# Eval("Message") %>
                </div>
                </ItemTemplate>

                <AlternatingItemTemplate>
                <div style="background-color:White">
                <b>                
                <span style="text-decoration:underline">
                <h1><%# Eval("Author") %></span></center></b></h1>
                <br />        
                <b>
                <%# Eval("Subject") %> </b>        
                <br />     
                <br />              
                <%# Eval("Message") %>
                </div>                
                </AlternatingItemTemplate>

                </asp:TemplateField>
            </Columns>
        </asp:GridView>
        </p>
        </div>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:MotorcyclesConn %>" 
            ProviderName="<%$ ConnectionStrings:MotorcyclesConn.ProviderName %>" 
            SelectCommand="SELECT [Author], [Subject], [Message] FROM [Comments] WHERE ([MotorcyclesID] = ?)">
            <SelectParameters>
                <asp:QueryStringParameter Name="MotorcyclesID" QueryStringField="ID" 
                    Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
        <p>    </p>
</asp:Content>
